﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Hammock.Web;

namespace TMWS
{
	using Utilities;

	/// <summary>
	/// Registration service
	/// </summary>
	public class RegistrationService : ServiceBase
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the <see cref="RegistrationService"/> class
		/// </summary>
		/// <param name="username">API username</param>
		/// <param name="password">APU password</param>
		public RegistrationService(string username, string password)
			: base(username, password, false)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="RegistrationService"/> class
		/// </summary>
		/// <param name="username">API username</param>
		/// <param name="password">APU password</param>
		/// <param name="enableLogging">Enable logging</param>
		/// <param name="logDirectory">Directory to store logs</param>
		public RegistrationService(string username, string password, bool enableLogging, string logDirectory)
			: base(username, password, enableLogging, logDirectory)
		{
		}

		#endregion

		#region Public Methods

		/// <summary>
		/// Gets the total player registrations count
		/// </summary>
		/// <returns>Registration count</returns>
		public int GetPlayerCount()
		{
			string resource = "tmf/registrations/";
			var playerCount = Execute<string>(resource, WebMethod.Get);

			return Convert.ToInt32(playerCount);
		}

		#endregion
	}
}